﻿Imports System.ComponentModel

<ToolboxItem(False)>
Public Class ucEnd
    Private mSuccess As Boolean
    Public Sub New(Success As Boolean)

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        mSuccess = Success
    End Sub
    Private Sub ucEnd_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim tString As String = ""
        If mSuccess = True Then
            If MyApp.IsUpdate = True Then
                tString = " updated successfully."
            Else
                tString = " installed successfully."
            End If
            pbUpdateStatus.Image = My.Resources.ok_button
        Else
            If MyApp.IsUpdate = True Then
                tString = " update failed."
            Else
                tString = " install failed."
            End If
            pbUpdateStatus.Image = My.Resources.application_error
        End If
        DisplayProgress(MyApp.ApplicationTitle & tString)

        If mSuccess = True Then
            DisplayMessage(String.Format("Please close {0} and start {1} ...", MyApp.UpdaterTitle, MyApp.ApplicationTitle))
        Else
            DisplayMessage(String.Format("Please close {0} and contact support!", MyApp.UpdaterTitle, MyApp.ApplicationTitle))
        End If

        gApp.ChangePage(MyApp.ApplicationType.EndApplication, True)
    End Sub
    Sub DisplayProgress(Message As String)
        lblProgress.Text = Message
        Application.DoEvents()
    End Sub
    Sub DisplayMessage(Message As String)
        lblMessage.Text = Message
        Application.DoEvents()
    End Sub
End Class
